package com.terrace.controller.system;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.terrace.db.system.mapper.entity.DictData;
import com.terrace.db.system.service.DictDataService;

/**
 * 组合框
 * @author jiangyg
 *
 */
@Controller
@Scope("prototype")
@RequestMapping("/combo")
public class ComboController {
	
	/**
	 * 日志
	 */
	private static final Logger logger = LoggerFactory.getLogger(ComboController.class);
	
	@Autowired
	private DictDataService dictDataService;
	
	/**
	 * 数据字典表
	 * @param code
	 * @return
	 */
	@ResponseBody
	@RequestMapping(params = "dictionary")
	public List<DictData> dictionary(@RequestParam(value = "code") String dictCode) {
		List<DictData> dictDataList = null;
		try {
			dictDataList = dictDataService.selectDictDatasByCode(dictCode);
		} catch (Exception e) {
			logger.error("获取数据字典值列表出错：", e);
		}
		return dictDataList;
	}

}
